<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var s = 0
        function fn(num) {

            if (num == 0) {
                return 0
            }
            return num + fn(num - 1)
        }
        // console.log(fn(5));

        var obj = {
            name: "zs",
            age: 12
        }

        var arr = [
            {
                name: "zs",
                age: 13
            },
            {
                name: "ls",
                age: 17
            }, {
                name: "ww",
                age: 16
            }
        ]

        // var obj2 = Object.assign({}, obj)
        // obj2.name = "ls"
        // console.log(obj2, obj);

        var obj3 = {}

        for (var i in obj) {
            // console.log(i,obj[i]);
            // obj3


        }

        var brr = []
        brr = arr.map((item) => {
            return {
                name: item.name,
                age: item.age
            }
        })
        brr[1].age = 23
        brr[0].name = "撒旦撒"
        var crr = [...arr]
        crr[0].name = "师父带"
        // console.log(brr,crr,arr);




        var objs = {
            name: "张三",
            gender: "男",
            age: 12
        }
        // for(var i in objs){
        //     console.log(i);
        //     console.log(objs[i]);
        // }
        // for(var i of objs){
        //     console.log(i);
        // }


        //   let promise=  new Promise(()=>{

        //     })

        for (var i = 0; i < 5; i++) {

            (function (i) {
                setTimeout(() => {
                    console.log(new Date(), i);
                })


            }(i))

        }

        new Promise((resolve, reject) => {

            console.log(111);
            setTimeout(() => {

                console.log(222);
                reject()
            })
        }).then(
            (res) => {
                console.log(333);
            },
            (err) => {
                console.log(444);
            }
        )
    </script>
</body>

</html>